module.exports = function(sequelize, DataTypes) {
    var CategoryRelateOption = sequelize.define('CategoryRelateOption', {
        _id: {
            type: DataTypes.INTEGER(11),
            allowNull: false,
            primaryKey: true,
            autoIncrement: true
        },
        num: {
            type: DataTypes.INTEGER,
            allowNull: false,
            field: "num",
            comment: "数量"
        }
    }, {
        timestamps: false,
        tableName: 'categoryRelateOption',
        classMethods: {
            associate: function (models) {
                CategoryRelateOption.belongsTo(models.Category, {foreignKey: 'categoryId', targetKey: '_id'});
                CategoryRelateOption.belongsTo(models.CategoryOptionSpread, {foreignKey: 'optionId', targetKey: '_id'});
            }
        }
    });
    return CategoryRelateOption;
}